/**
 * @Project TMHSCFX
 * @Author Tran Manh Hung
 * @Email: hungtmit@gmail.com | tmh@xwebgate.com
 * @Copyright © 2011 TMH. All rights reserved
 * @Createdate Apr 15, 2011
 * @Createtime 11:48:19 PM
 */

package com.tmh.study.fAS3AMTM.chap5
{
	import flash.display.Sprite;
	import flash.events.Event;

	public class Ship extends Sprite
	{
		public function Ship()
		{
			super();
			addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
		}

		private function addedToStageHandler(event:Event):void
		{
			draw(false);
		}

		public function draw(showFlame:Boolean):void
		{
			graphics.clear();
			graphics.lineStyle(1, 0xcc0000);
			graphics.moveTo(10, 0);
			graphics.lineTo(-10, 10);
			graphics.lineTo(-5, 0);
			graphics.lineTo(-10, -10);
			graphics.lineTo(10, 0);

			if (showFlame)
			{
				graphics.moveTo(-7.5, -5)
				graphics.lineTo(-15, 0);
				graphics.lineTo(-7.5, 5);
			}
		}
	}
}